<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>1.有一个对象obj，给它添加一个属性“firstname”，值为“judd”。下面选项中语法错误的是？（选择两项） |  zfy的个人博客</title>
    <meta name="generator" content="VuePress 1.9.7">
    <link rel="icon" href="./img/Scorpio.png">
    <link rel="stylesheet" href="./css/style.css">
    <meta name="description" content="My tech blog">
    
    <link rel="preload" href="./assets/css/0.styles.cfdaa54c.css" as="style"><link rel="preload" href="./assets/js/app.7878252f.js" as="script"><link rel="preload" href="./assets/js/2.877879cc.js" as="script"><link rel="preload" href="./assets/js/84.26baaa09.js" as="script"><link rel="prefetch" href="./assets/js/10.a489e96f.js"><link rel="prefetch" href="./assets/js/11.f6f26a2f.js"><link rel="prefetch" href="./assets/js/12.8a827e29.js"><link rel="prefetch" href="./assets/js/13.e420b04a.js"><link rel="prefetch" href="./assets/js/14.52f00cc6.js"><link rel="prefetch" href="./assets/js/15.ef68d553.js"><link rel="prefetch" href="./assets/js/16.c2999dfd.js"><link rel="prefetch" href="./assets/js/17.0adb748c.js"><link rel="prefetch" href="./assets/js/18.2c077020.js"><link rel="prefetch" href="./assets/js/19.013b5e02.js"><link rel="prefetch" href="./assets/js/20.bb3b854e.js"><link rel="prefetch" href="./assets/js/21.28efc78c.js"><link rel="prefetch" href="./assets/js/22.4a1d71dd.js"><link rel="prefetch" href="./assets/js/23.605a5451.js"><link rel="prefetch" href="./assets/js/24.66bf035d.js"><link rel="prefetch" href="./assets/js/25.fbe72655.js"><link rel="prefetch" href="./assets/js/26.3f374d1f.js"><link rel="prefetch" href="./assets/js/27.556ea617.js"><link rel="prefetch" href="./assets/js/28.0cab868b.js"><link rel="prefetch" href="./assets/js/29.564f8747.js"><link rel="prefetch" href="./assets/js/3.4cfb1b9c.js"><link rel="prefetch" href="./assets/js/30.c4a099d1.js"><link rel="prefetch" href="./assets/js/31.7fbc3d2a.js"><link rel="prefetch" href="./assets/js/32.8f356b20.js"><link rel="prefetch" href="./assets/js/33.b5a1b0bb.js"><link rel="prefetch" href="./assets/js/34.57086c2e.js"><link rel="prefetch" href="./assets/js/35.2b4d0231.js"><link rel="prefetch" href="./assets/js/36.a99f6d64.js"><link rel="prefetch" href="./assets/js/37.eb25dcef.js"><link rel="prefetch" href="./assets/js/38.e45d8594.js"><link rel="prefetch" href="./assets/js/39.213e3a72.js"><link rel="prefetch" href="./assets/js/4.b86a0fbe.js"><link rel="prefetch" href="./assets/js/40.cadafdd6.js"><link rel="prefetch" href="./assets/js/41.23b0f26d.js"><link rel="prefetch" href="./assets/js/42.7c2b83c6.js"><link rel="prefetch" href="./assets/js/43.62f328ea.js"><link rel="prefetch" href="./assets/js/44.c4dfbd34.js"><link rel="prefetch" href="./assets/js/45.cde5bb22.js"><link rel="prefetch" href="./assets/js/46.6c62bdb8.js"><link rel="prefetch" href="./assets/js/47.4857766a.js"><link rel="prefetch" href="./assets/js/48.55a0cccc.js"><link rel="prefetch" href="./assets/js/49.3dceda91.js"><link rel="prefetch" href="./assets/js/5.13776f82.js"><link rel="prefetch" href="./assets/js/50.ab4d52fa.js"><link rel="prefetch" href="./assets/js/51.69ccc35a.js"><link rel="prefetch" href="./assets/js/52.01f3f711.js"><link rel="prefetch" href="./assets/js/53.c146a1ff.js"><link rel="prefetch" href="./assets/js/54.71ce70c2.js"><link rel="prefetch" href="./assets/js/55.98ef481d.js"><link rel="prefetch" href="./assets/js/56.b23daa51.js"><link rel="prefetch" href="./assets/js/57.6aa314ad.js"><link rel="prefetch" href="./assets/js/58.7d6367d9.js"><link rel="prefetch" href="./assets/js/59.88894cf5.js"><link rel="prefetch" href="./assets/js/6.93d89692.js"><link rel="prefetch" href="./assets/js/60.111f9a04.js"><link rel="prefetch" href="./assets/js/61.add82aab.js"><link rel="prefetch" href="./assets/js/62.8bfac830.js"><link rel="prefetch" href="./assets/js/63.db44a5ca.js"><link rel="prefetch" href="./assets/js/64.0244f0ef.js"><link rel="prefetch" href="./assets/js/65.2be994de.js"><link rel="prefetch" href="./assets/js/66.c5066e37.js"><link rel="prefetch" href="./assets/js/67.c11b474b.js"><link rel="prefetch" href="./assets/js/68.276bdc3e.js"><link rel="prefetch" href="./assets/js/69.f5f39d50.js"><link rel="prefetch" href="./assets/js/7.ca9f7e96.js"><link rel="prefetch" href="./assets/js/70.e3ca02b0.js"><link rel="prefetch" href="./assets/js/71.befcf8f7.js"><link rel="prefetch" href="./assets/js/72.04fabafd.js"><link rel="prefetch" href="./assets/js/73.e5b707f2.js"><link rel="prefetch" href="./assets/js/74.b5668150.js"><link rel="prefetch" href="./assets/js/75.eb7cfac9.js"><link rel="prefetch" href="./assets/js/76.c1b76370.js"><link rel="prefetch" href="./assets/js/77.5875e953.js"><link rel="prefetch" href="./assets/js/78.a5e2fa5b.js"><link rel="prefetch" href="./assets/js/79.eb2d51a7.js"><link rel="prefetch" href="./assets/js/8.570c39ea.js"><link rel="prefetch" href="./assets/js/80.7252ac50.js"><link rel="prefetch" href="./assets/js/81.eb980d26.js"><link rel="prefetch" href="./assets/js/82.9e069d8f.js"><link rel="prefetch" href="./assets/js/83.8c5a6dc6.js"><link rel="prefetch" href="./assets/js/85.96bc7e77.js"><link rel="prefetch" href="./assets/js/86.9c9dd1ca.js"><link rel="prefetch" href="./assets/js/87.d54639b8.js"><link rel="prefetch" href="./assets/js/88.3d3ae1e1.js"><link rel="prefetch" href="./assets/js/89.a81caa83.js"><link rel="prefetch" href="./assets/js/9.7a58df3d.js"><link rel="prefetch" href="./assets/js/90.c3c347ed.js"><link rel="prefetch" href="./assets/js/91.b6240032.js"><link rel="prefetch" href="./assets/js/92.8331718a.js"><link rel="prefetch" href="./assets/js/93.ca174cfa.js"><link rel="prefetch" href="./assets/js/94.fec3300c.js"><link rel="prefetch" href="./assets/js/95.076b06fb.js"><link rel="prefetch" href="./assets/js/96.8ed8b32f.js">
    <link rel="stylesheet" href="./assets/css/0.styles.cfdaa54c.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/./" class="home-link router-link-active"><!----> <span class="site-name"> zfy的个人博客</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="http://127.0.0.1:3002/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  自由博客板块
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="http://zfyangelo.gitee.io/yu-weather-web-show/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  天气预报
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="/./guide/" class="nav-link router-link-active">
  个人的学习笔记
</a></div><div class="nav-item"><a href="/./baodian/interview/" class="nav-link">
  项目及在校经历
</a></div><div class="nav-item"><a href="/./baodian/talk/" class="nav-link">
  爱好和联系方式
</a></div><div class="nav-item"><a href="https://gitee.com/zfyangelo" target="_blank" rel="noopener noreferrer" class="nav-link external">
  我的gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="http://127.0.0.1:3002/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  自由博客板块
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="http://zfyangelo.gitee.io/yu-weather-web-show/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  天气预报
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><a href="/./guide/" class="nav-link router-link-active">
  个人的学习笔记
</a></div><div class="nav-item"><a href="/./baodian/interview/" class="nav-link">
  项目及在校经历
</a></div><div class="nav-item"><a href="/./baodian/talk/" class="nav-link">
  爱好和联系方式
</a></div><div class="nav-item"><a href="https://gitee.com/zfyangelo" target="_blank" rel="noopener noreferrer" class="nav-link external">
  我的gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>HTML</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>CSS</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Javascipt</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>HTML&amp;CSS练习</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Javascipt练习</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/./guide/notes/jswork/01-认识javascript.html" class="sidebar-link">01-认识javaScript</a></li><li><a href="/./guide/notes/jswork/02-变量与数据类型.html" class="sidebar-link">02-变量与数据类型</a></li><li><a href="/./guide/notes/jswork/03-DOM.html" class="sidebar-link">03-DOM</a></li><li><a href="/./guide/notes/jswork/04-表达式和操作符.html" class="sidebar-link">04-表达式和操作符</a></li><li><a href="/./guide/notes/jswork/05-判断.html" class="sidebar-link">05-判断</a></li><li><a href="/./guide/notes/jswork/06-循环.html" class="sidebar-link">06-循环</a></li><li><section class="sidebar-group collapsable is-sub-group depth-1"><p class="sidebar-heading"><span>07-暂无</span> <span class="arrow right"></span></p> <!----></section></li><li><a href="/./guide/notes/jswork/08-函数.html" class="sidebar-link">08-函数</a></li><li><a href="/./guide/notes/jswork/09-案例.html" class="sidebar-link">09-案例</a></li><li><a href="/./guide/notes/jswork/10-数组.html" class="sidebar-link">10-数组</a></li><li><a href="/./guide/notes/jswork/11-字符串.html" class="sidebar-link">11-字符串</a></li><li><a href="/./guide/notes/jswork/12-DOM.html" class="sidebar-link">12-DOM</a></li><li><a href="/./guide/notes/jswork/13-浏览器操作.html" class="sidebar-link">13-BOM</a></li><li><a href="/./guide/notes/jswork/14-面向project.html" class="active sidebar-link">14-面向对象</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/./guide/notes/jswork/15-Js阶段测试组卷.html" class="sidebar-link">15-Js阶段测试组卷</a></li><li><a href="/./guide/notes/jswork/16-模板字符串箭头函数变量声明.html" class="sidebar-link">16-模板字符串箭头函数变量声明</a></li><li><a href="/./guide/notes/jswork/17-解构赋值.html" class="sidebar-link">17-解构赋值</a></li><li><a href="/./guide/notes/jswork/18-project字面量增强和函数默认参数.html" class="sidebar-link">18-对象字面量增强和函数默认参数</a></li><li><a href="/./guide/notes/jswork/19-剩余参数和数组展开.html" class="sidebar-link">19-剩余参数和数组展开</a></li><li><a href="/./guide/notes/jswork/20-Map Set.html" class="sidebar-link">20-Map Set</a></li><li><a href="/./guide/notes/jswork/21-iterator和for...of循环.html" class="sidebar-link">21-iterator和for...of循环</a></li><li><a href="/./guide/notes/jswork/22-Promise和class.html" class="sidebar-link">22-Promise和class</a></li><li><a href="/./guide/notes/jswork/23-module.html" class="sidebar-link">23-module</a></li><li><a href="/./guide/notes/jswork/24-ES6测评题目.html" class="sidebar-link">24-ES6测评题目</a></li><li><a href="/./guide/notes/jswork/25-本地存储和http.html" class="sidebar-link">25-本地存储和http</a></li><li><a href="/./guide/notes/jswork/26-ajax选择题.html" class="sidebar-link">26-ajax选择题</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h3 id="_1-有一个对象obj-给它添加一个属性-firstname-值为-judd-。下面选项中语法错误的是-选择两项"><a href="#_1-有一个对象obj-给它添加一个属性-firstname-值为-judd-。下面选项中语法错误的是-选择两项" class="header-anchor">#</a> 1.有一个对象obj，给它添加一个属性“firstname”，值为“judd”。下面选项中语法错误的是？（选择两项）</h3> <p>**A.**obj[firstname]='judd'</p> <p>**B.**obj.'firstname'='judd'</p> <p>**C.**obj.firstname='judd'</p> <p>**D.**obj['firstname']='judd'</p> <p><strong>本题考查对象属性的添加。</strong></p> <p>对象添加属性有两种语法，一种是点语法，属性名不需要引号包裹，如C选项中的obj.firstname='judd'。还有一种是中括号语法，属性名要使用引号包裹，如D选项中的obj['firstname']='judd'。</p> <p>A选项中，使用中括号语法，属性名没有使用引号包裹错误。</p> <p>B选项中，使用点语法，属性名多加了一对引号错误。</p> <p><strong>所以本题正确答案为AB。</strong></p> <h3 id="_2-以下哪种方法可以在控制台输出-小课-选择两项"><a href="#_2-以下哪种方法可以在控制台输出-小课-选择两项" class="header-anchor">#</a> 2.以下哪种方法可以在控制台输出“小课”?<strong>（<strong>选择两项</strong>）</strong></h3> <p><a href="https://imgchr.com/i/BH7kk9" target="_blank" rel="noopener noreferrer"><img src="https://s1.ax1x.com/2020/11/09/BH7kk9.png" alt="BH7kk9.png"><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>**A.**person. username()</p> <p>**B.**console.log(person. username)</p> <p>**C.**console.log(person.fn)</p> <p>**D.**person.fn()</p> <p><strong>本题考查对象属性的获取以及方法的调用。</strong></p> <p>username是对象person的属性，获取时不需要加括号调用，所以A错误，B正确。</p> <p>fn是对象person的方法，方法就是一个函数，需要加括号调用，即person.fn()，所以C错误，D正确。</p> <p><strong>本题答案为BD。</strong></p> <h3 id="_3-以下代码中-弹出的结果依次为-选择一项"><a href="#_3-以下代码中-弹出的结果依次为-选择一项" class="header-anchor">#</a> 3. 以下代码中，弹出的结果依次为？（选择一项）</h3> <p><a href="https://imgchr.com/i/BH7bjK" target="_blank" rel="noopener noreferrer"><img src="https://s1.ax1x.com/2020/11/09/BH7bjK.png" alt="BH7bjK.png"><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>**A.**牙刷，5，牙刷的价格为5元</p> <p>**B.**牙刷，5，fn:function(){alert(“牙刷的价格为5元”)}</p> <p>**C.**product, price, fn</p> <p>**D.**product, price,function</p> <p><strong>参考解析：</strong></p> <p>本题考查for..in遍历对象。</p> <p>for..in遍历对象的基本语法为for(var i in obj){} ，其中i表示对象的属性名，obj表示要遍历的对象。本题代码中，遍历时输出i，所以会输出对象obj的属性名，即product, price,fn，<strong>本题答案为C。</strong></p> <h3 id="_4-以下代码-输出的结果是-选择一项"><a href="#_4-以下代码-输出的结果是-选择一项" class="header-anchor">#</a> 4.以下代码，输出的结果是？（选择一项）</h3> <p><a href="https://imgchr.com/i/BHbFR1" target="_blank" rel="noopener noreferrer"><img src="https://s1.ax1x.com/2020/11/09/BHbFR1.png" alt="BHbFR1.png"><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>**A.**1</p> <p>**B.**2</p> <p>**C.**3</p> <p>**D.**4</p> <p><strong>本题考查函数的执行上下文。</strong></p> <p>本题代码中，先调用了obj对象的a方法，并把返回值this.b赋值给全局变量obj1。a方法是obj调用的，所以a中的this指向obj。那么this.b获取到的是obj的b方法，后面调用obj1相当于调用了obj的b方法。obj1是在全局下面调用的，所以b方法中的this指向的是全局对象window，所以this.c获取的就是全局下的变量c，输出结果为1**，本题答案为A。**</p> <h3 id="_5-以下代码的输出结果为-选择一项"><a href="#_5-以下代码的输出结果为-选择一项" class="header-anchor">#</a> 5.以下代码的输出结果为？（选择一项）</h3> <p><a href="https://imgchr.com/i/BHbgwF" target="_blank" rel="noopener noreferrer"><img src="https://s1.ax1x.com/2020/11/09/BHbgwF.png" alt="BHbgwF.png"><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>**A.**6</p> <p>**B.**5</p> <p>**C.**2</p> <p>**D.**1</p> <p><strong>本题考查数组中的执行上下文</strong></p> <p>数组中的元素如果是函数，那么通过数组下标的方式调用函数，这个函数中执行上下文，就是这个数组。</p> <p>本题代码中，obj的属性c是一个数组，我们后面叫它数组c。数组c中下标为2的元素是一个函数，所以obj.c<a href="">2</a>就是取到数组下标为2的元素并调用，这个函数的this指向的就是数组c。this[1]拿到的就是数组c下标为1的元素a，a没有加引号，是一个变量，变量a的值为6，所以结果输出6，<strong>本题答案为A。</strong></p> <h3 id="_6-以下说法中-错误的是-选择一项"><a href="#_6-以下说法中-错误的是-选择一项" class="header-anchor">#</a> 6.以下说法中，错误的是？（选择一项）</h3> <p>**A.**定时器中的上下文是window</p> <p>**B.**在全局下直接调用函数，函数里面的上下文是window</p> <p>**C.**事件处理函数中的上下文是绑定事件的元素</p> <p>**D.**对象方法中的上下文是这个对象自身</p> <p><strong>本题考查上下文的规则。</strong></p> <p>定时器中的上下文是window，A说法正确。</p> <p>在全局下直接调用函数，函数里面的上下文是window，B说法正确。</p> <p>事件处理函数中的上下文是绑定事件的元素，C说法正确。</p> <p>对象的方法中，上下文不一定是这个对象自身，要看如何调用的。如果是对象.方法名（）方式调用的，那么指向的是对象自身。如果是获取到方法赋值给一个全局变量，然后调用全局变量，此时指向的是window,D说法错误，<strong>所以本题答案为D。</strong></p> <h3 id="_7-补充哪一个选项的代码-可以让如下代码输出15-选择两项"><a href="#_7-补充哪一个选项的代码-可以让如下代码输出15-选择两项" class="header-anchor">#</a> 7.补充哪一个选项的代码，可以让如下代码输出15？（选择两项）</h3> <p><a href="https://imgchr.com/i/BHqd0O" target="_blank" rel="noopener noreferrer"><img src="https://s1.ax1x.com/2020/11/09/BHqd0O.png" alt="BHqd0O.png"><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>**A.**obj1.call(this,this.a,this.b)</p> <p>**B.**obj1.call(this,[this.a,this.b])</p> <p>**C.**obj1.apply(this,this.a,this.b)</p> <p>**D.**obj1.apply(this,[this.a,this.b])</p> <p><strong>本题考查call和apply的使用。</strong></p> <p>call和apply用法相似，第一个参数用来指定上下文。区别在于后面的参数：</p> <p>call要把传递的参数，直接用逗号一个一个隔开，而apply要把传递的参数，使用数组包裹起来。B中，call的第二个参数是传递了一个数组错误，正确的应该是A中直接把参数隔开。C中，apply的后两个参数没有使用数组包裹错误，正确的应该是D中把后两个参数放在一个数组中。</p> <p><strong>所以本题答案为AD。</strong></p> <h3 id="_8-下面的代码运行结果是-选择一项"><a href="#_8-下面的代码运行结果是-选择一项" class="header-anchor">#</a> 8.下面的代码运行结果是？（选择一项）</h3> <p><a href="https://imgchr.com/i/BHqOBT" target="_blank" rel="noopener noreferrer"><img src="https://s1.ax1x.com/2020/11/09/BHqOBT.png" alt="BHqOBT.png"><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p><strong>A.</strong>-55</p> <p>**B.**55</p> <p>**C.**0</p> <p>**D.**NaN</p> <p><strong>本题考查min()方法。</strong></p> <p>min()返回指定的数组中最小的那个数字，如果参数中包含不能转换成数字的非数字值，则返回NaN。本题代码中，字符串&quot;a&quot;不能转换为数字，<strong>所以答案为D。</strong></p> <h3 id="_9-关于math-random-方法-下列说法正确的是-选择一项"><a href="#_9-关于math-random-方法-下列说法正确的是-选择一项" class="header-anchor">#</a> 9.关于Math.random（）方法，下列说法正确的是？（选择一项）</h3> <p>**A.**该方法返回的是一个大于0并且小于1的随机数</p> <p>**B.**该方法返回的是一个大于0并且小于1的整数</p> <p>**C.**该方法返回的是一个大于等于0并且小于1的随机数</p> <p>**D.**该方法返回的是一个大于等于0并且小于1的整数</p> <p><strong>参考解析：</strong></p> <p>本题考查Math.random（）方法。</p> <p>该方法返回的是一个大于等于0并且小于1的随机数，不是整数。</p> <p>所以<strong>本题正确答案为C</strong></p> <h3 id="_10-下列选项关于date对象的说法正确的是-选择两项"><a href="#_10-下列选项关于date对象的说法正确的是-选择两项" class="header-anchor">#</a> 10.下列选项关于date对象的说法正确的是？（选择两项）</h3> <p>**A.**getDate（）方法返回一个月中的某一天</p> <p>**B.**getDay（）方法返回一个月中的某一天</p> <p>**C.**getTime（）方法返回一天中的某个时间</p> <p>**D.**getTime（）方法返回1970年1月1日至今的毫秒数</p> <p><strong>本题考查date对象的方法</strong>。</p> <p>getDate（）对象返回一个月中的某一天；</p> <p>getDay（）对象返回一周中的某一天；</p> <p>getTime（）返回1970年1月1日至今的毫秒数；</p> <p><strong>所以本题答案为AD。</strong></p> <h3 id="_11-补充题干中的代码-以便获取到今天是本月中的那一天-选择一项"><a href="#_11-补充题干中的代码-以便获取到今天是本月中的那一天-选择一项" class="header-anchor">#</a> 11.补充题干中的代码，以便获取到今天是本月中的那一天？（选择一项）</h3> <p><a href="https://imgchr.com/i/BHLgPJ" target="_blank" rel="noopener noreferrer"><img src="https://s1.ax1x.com/2020/11/09/BHLgPJ.png" alt="BHLgPJ.png"><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>**A.**date.getDate()</p> <p>**B.**date.getDay()</p> <p>**C.**date.getTime()</p> <p>**D.**date</p> <p><strong>本题考查date对象的方法。</strong></p> <p>getDate()对象返回一个月中的某一天；</p> <p>getDay()对象返回一周中的某一天；</p> <p>getTime()放回1970年1月1日至今的毫秒数。</p> <p><strong>所以本题答案为A。</strong></p> <h3 id="_12-补充题干中的代码-以便获取到现在的月份-选择一项"><a href="#_12-补充题干中的代码-以便获取到现在的月份-选择一项" class="header-anchor">#</a> 12.补充题干中的代码，以便获取到现在的月份？（选择一项）</h3> <p><a href="https://imgchr.com/i/BHOuoF" target="_blank" rel="noopener noreferrer"><img src="https://s1.ax1x.com/2020/11/09/BHOuoF.png" alt="BHOuoF.png"><span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>**A.**date.getMonth()</p> <p>**B.**date. getMonth()-1</p> <p>**C.**date. getMonth()+1</p> <p>**D.**date. getMonth()+2</p> <p><strong>本题考查date对象的方法。</strong></p> <p>getMonth()方法返回表示月份的数字，返回值是0（一月）到11（十二月）之间的一个整数。例如获取9月份，返回的是数字8，所以要在返回的数字上加1，即date. getMonth()+1。</p> <p><strong>所以本题答案为C。</strong></p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/./guide/notes/jswork/13-浏览器操作.html" class="prev">
        13-BOM
      </a></span> <span class="next"><a href="/./guide/notes/jswork/15-Js阶段测试组卷.html">
        15-Js阶段测试组卷
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----><div class="reco-bgm-panel" data-v-b1d3339e><audio id="bgm" src="https://www.ytmp3.cn/down/75475.mp3" data-v-b1d3339e></audio> <div class="reco-float-box" style="bottom:30px;z-index:999999;display:none;" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><img src="https://p1.music.126.net/qTSIZ27qiFvRoKj-P30BiA==/109951165895951287.jpg?param=200y200" data-v-b1d3339e></div> <div class="reco-bgm-box" style="left:10px;bottom:10px;z-index:999999;" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><div class="reco-bgm-cover" style="background-image:url(https://p1.music.126.net/qTSIZ27qiFvRoKj-P30BiA==/109951165895951287.jpg?param=200y200);" data-v-b1d3339e><div class="mini-operation" style="display:none;" data-v-b1d3339e><i class="reco-bgm reco-bgm-pause" style="display:none;" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-play" style="display:none;" data-v-b1d3339e></i></div> <div class="falut-message" style="display:none;" data-v-b1d3339e>
          播放失败
        </div></div> <div class="reco-bgm-info" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><div class="info-box" data-v-b1d3339e><i class="reco-bgm reco-bgm-music music" data-v-b1d3339e></i>花花公子</div> <div class="info-box" data-v-b1d3339e><i class="reco-bgm reco-bgm-artist" data-v-b1d3339e></i>马思唯/step.jad</div> <div class="reco-bgm-progress" data-v-b1d3339e><div class="progress-bar" data-v-b1d3339e><div class="bar" data-v-b1d3339e></div></div></div> <div class="reco-bgm-operation" data-v-b1d3339e><i class="reco-bgm reco-bgm-last last" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-pause pause" style="display:none;" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-play play" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-next next" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-volume1 volume" data-v-b1d3339e></i> <i class="reco-bgm reco-bgm-mute mute" style="display:none;" data-v-b1d3339e></i> <div class="volume-bar" data-v-b1d3339e><div class="bar" data-v-b1d3339e></div></div></div></div> <div class="reco-bgm-left-box" data-v-b1d3339e data-v-41bcba48 data-v-b1d3339e><i class="reco-bgm reco-bgm-left" data-v-b1d3339e></i></div></div></div></div></div>
    <script src="./assets/js/app.7878252f.js" defer></script><script src="./assets/js/2.877879cc.js" defer></script><script src="./assets/js/84.26baaa09.js" defer></script>
  </body>
</html>
